<?php
class ModelFactory
{
	private static $_instance=array();
	private static $_classes=array(
		'default'=>array(
			'UserModel'=>'/model/UserModel.php',
			'SinaModel'=>'/model/SinaModel.php',
			'GroupModel'=>'/model/GroupModel.php',
			'GroupUserModel'=>'/model/GroupUserModel.php',
			'CheckoutModel'=>'/model/CheckoutModel.php',
			'CheckoutUserModel'=>'/model/CheckoutUserModel.php',
			'BillModel'=>'/model/BillModel.php',
			'BillItemModel'=>'/model/BillItemModel.php',
		),
	);
	
	public static function get($className,$module='default') {
		if(!isset(self::$_instance[$module][$className])){
			include_once PATH_API.self::$_classes[$module][$className];
			self::$_instance[$module][$className]=new $className();
		}
		return self::$_instance[$module][$className];
	}
}
